<template>
	<el-pagination @current-change="handleCurrentChange" :current-page="currentPage"
	  :page-size="pageSize" :layout="layouts" :total="totalNum" background>
	</el-pagination>
</template>

<script>
	export default {
		name: 'pagination',
		props:['totalNum', 'current'],
		data() {
			return {
				currentPage: this.current?this.current:1,
				pageSize: $globalData.pageSize,
				layouts: 'prev, pager, next'
			}
		},
		mounted() {
			// console.log(this.current)
		},
		methods: {
			handleCurrentChange(val) {
				// currentPage 改变时触发，向父组件传递参数,父组件pageNum的值为val
				this.$emit('paginaClick', val)
			}
		}
	}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
	.el-pagination {
		text-align: right;
		margin-top: 20px;
	}
</style>
<style>
	.el-pagination.is-background .el-pager li:not(.disabled).active{
		border: 1px solid #24B14E;
		color: #24B14E;
		    background: none;
	}
</style>